package com.lyw.spring.demo.controller;

import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/user2")
public class User2Controller {

    //既支持post请求，也支持get请求
    @RequestMapping("/m1")
    public String m1() {
        return "hello, hello m1";
    }

    //只支持get请求
    @RequestMapping(value = "/m2", method = RequestMethod.GET)
    //@RequestMapping(value = "/m2", method = {RequestMethod.GET, RequestMethod.POST})
    public String m2() {
        return "hello, hello m2";
    }

    //只支持post请求
    @RequestMapping(value = "/m3", method = RequestMethod.POST)
    public String m3() {
        return "hello, hello m3";
    }

    //只支持get请求
    @GetMapping("/m4")
    public String m4() {
        return "hello, hello m4";
    }

    //只支持post请求
    @PostMapping("/m5")
    public String m5() {
        return "hello, hello m5";
    }


}
